package com.gyb.order.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import com.netflix.appinfo.InstanceInfo;
import com.netflix.discovery.EurekaClient;

@RestController
public class OrderController {
	
	@Autowired
	private EurekaClient eurekaClient;
	

    @GetMapping("/{id}")
    public String get(@PathVariable int id){
    	System.out.println("appserviceA："+id);
        return "app-serviceA response result："+id;
    }
    
    @GetMapping("/eureka-instance")
    public Object getInstance(){
    	
    	InstanceInfo info = eurekaClient.getNextServerFromEureka("app-serviceA", false);
        return info.getHomePageUrl();
    }
    
    
}
